package kernel.stl;

/**
 *
 * @author George
 */
public class Vertex {
    
    private double x;
    private double y;
    private double z;
    
    public Vertex(double x, double y, double z) {
        this.x = x;
        this.y = y;
        this.z = z;
    }
    
    public void moveX(double offset) {
        this.x = this.x + offset;
    }
    
    public void moveY(double offset) {
        this.y = this.y + offset;
    }
    
    public void moveZ(double offset) {
        this.z = this.z + offset; 
    }
    
    public boolean equals(PointXYZ otherVertex, double tolerance) {
        if (Math.abs(this.getX() - otherVertex.getX()) > tolerance)
            return false;
        else if (Math.abs(this.getY() - otherVertex.getY()) > tolerance)
            return false;
        else if (Math.abs(this.getZ() - otherVertex.getZ()) > tolerance)
            return false;
        return true;
    }
    
    
    public double getX() {
        return this.x;        
    }
    
    public double getY() {
        return this.y;
    }
    
    public double getZ() {
        return this.z;
    }
    
    public Vector toVector() {
        Vector v = new Vector(getX(), getY(), getZ()); 
        return v;
    }

}
